﻿using System;

namespace HalconDotNet
{
	// Token: 0x0200009B RID: 155
	internal class HTupleString : HTupleImplementation
	{
		// Token: 0x06001FA7 RID: 8103 RVA: 0x000BA0F4 File Offset: 0x000B82F4
		protected override Array CreateArray(int size)
		{
			string[] array = new string[size];
			for (int i = 0; i < size; i++)
			{
				array[i] = "";
			}
			return array;
		}

		// Token: 0x06001FA8 RID: 8104 RVA: 0x000BA11D File Offset: 0x000B831D
		protected override void NotifyArrayUpdate()
		{
			this.s = (string[])this.data;
		}

		// Token: 0x06001FA9 RID: 8105 RVA: 0x000BA130 File Offset: 0x000B8330
		public HTupleString(string s)
		{
			base.SetArray(new string[]
			{
				s
			}, false);
		}

		// Token: 0x06001FAA RID: 8106 RVA: 0x000B9AE4 File Offset: 0x000B7CE4
		public HTupleString(string[] s, bool copy)
		{
			base.SetArray(s, copy);
		}

		// Token: 0x06001FAB RID: 8107 RVA: 0x000BA149 File Offset: 0x000B8349
		public override HTupleElements GetElement(int index, HTuple parent)
		{
			return new HTupleElements(parent, this, index);
		}

		// Token: 0x06001FAC RID: 8108 RVA: 0x000BA153 File Offset: 0x000B8353
		public override HTupleElements GetElements(int[] indices, HTuple parent)
		{
			if (indices == null || indices.Length == 0)
			{
				return new HTupleElements();
			}
			return new HTupleElements(parent, this, indices);
		}

		// Token: 0x06001FAD RID: 8109 RVA: 0x000BA16A File Offset: 0x000B836A
		public override void SetElements(int[] indices, HTupleElements elements)
		{
			new HTupleElementsString(this, indices).setS(elements.SArr);
		}

		// Token: 0x1700009A RID: 154
		// (get) Token: 0x06001FAE RID: 8110 RVA: 0x000BA17E File Offset: 0x000B837E
		// (set) Token: 0x06001FAF RID: 8111 RVA: 0x000B9B31 File Offset: 0x000B7D31
		public override string[] SArr
		{
			get
			{
				return this.s;
			}
			set
			{
				base.SetArray(value, false);
			}
		}

		// Token: 0x1700009B RID: 155
		// (get) Token: 0x06001FB0 RID: 8112 RVA: 0x000B8854 File Offset: 0x000B6A54
		public override HTupleType Type
		{
			get
			{
				return HTupleType.STRING;
			}
		}

		// Token: 0x06001FB1 RID: 8113 RVA: 0x000BA186 File Offset: 0x000B8386
		public override string[] ToSArr()
		{
			return (string[])base.ToArray(this.typeS);
		}

		// Token: 0x06001FB2 RID: 8114 RVA: 0x000BA199 File Offset: 0x000B8399
		public override int CopyToSArr(string[] dst, int offset)
		{
			Array.Copy(this.s, 0, dst, offset, this.iLength);
			return this.iLength;
		}

		// Token: 0x06001FB3 RID: 8115 RVA: 0x000BA1B8 File Offset: 0x000B83B8
		public override int CopyToOArr(object[] dst, int offset)
		{
			for (int i = 0; i < this.iLength; i++)
			{
				dst[i + offset] = this.s[i];
			}
			return this.iLength;
		}

		// Token: 0x06001FB4 RID: 8116 RVA: 0x000BA1E9 File Offset: 0x000B83E9
		public override int CopyFrom(HTupleImplementation impl, int offset)
		{
			return impl.CopyToSArr(this.s, offset);
		}

		// Token: 0x06001FB5 RID: 8117 RVA: 0x000BA1F8 File Offset: 0x000B83F8
		protected override void StoreData(IntPtr proc, IntPtr tuple)
		{
			for (int i = 0; i < this.iLength; i++)
			{
				HalconAPI.HCkP(proc, HalconAPI.SetS(tuple, i, this.s[i], false));
			}
		}

		// Token: 0x06001FB6 RID: 8118 RVA: 0x000BA22C File Offset: 0x000B842C
		public static int Load(IntPtr tuple, out HTupleString data, bool force_utf8)
		{
			int num = 2;
			int num2;
			HalconAPI.GetTupleLength(tuple, out num2);
			string[] array = new string[num2];
			for (int i = 0; i < num2; i++)
			{
				if (!HalconAPI.IsFailure(num))
				{
					num = HalconAPI.GetS(tuple, i, out array[i], force_utf8);
				}
			}
			data = new HTupleString(array, false);
			return num;
		}

		// Token: 0x04001189 RID: 4489
		protected string[] s;
	}
}
